home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Views
/
Pane.cp
< prev
next >
Wrap
Text File
|
1997-06-28
|
1KB
|
88 lines
// Pane.cp
#ifndef Pane_h
#include "Pane.h"
#endif
#ifndef View_h
#include "View.h"
#endif
Pane::Pane()
: window( 0 ),
bounds( Rectangle::zero ),
view( 0 )
{
}
Pane::~Pane()
{
if ( view != 0 )
ClearView();
}
const Sizeable& Pane::Size() const
{
if ( view == 0 )
return Sizeable::empty;
return *view;
}
void Pane::SetView( View& newView )
{
Assert( view == 0 );
Assert( newView.owner == 0 );
view = &newView;
newView.owner = this;
if ( window != 0 )
newView.GainMapping();
}
void Pane::ClearView()
{
Assert( view != 0 );
Assert( view->owner == this );
View& oldView = *view;
view = 0;
oldView.owner = 0;
if ( window != 0 )
oldView.LoseMapping();
}
void Pane::MapTo( WindowObject& newWindow )
{
Assert( window == 0 );
window = &newWindow;
if ( view != 0 )
view->GainMapping();
}
void Pane::Unmap()
{
Assert( window != 0 );
window = 0;
bounds = Rectangle::zero;
if ( view != 0 )
view->LoseMapping();
}
void Pane::SetBounds( Rectangle newBounds )
{
if ( bounds == newBounds )
return;
Rectangle oldBounds( bounds );
bounds = newBounds;
if ( view != 0 )
view->ChangeBounds( oldBounds );
}